<form action="${CONTEXT_PATH}/m/menu/save" method="post" id="menu_add" class="form-horizontal">
<#include "/WEB-INF/template/page/admin/system/menu/_form.ftl"/>
</form>
<script type="text/javascript">
    jQuery("#menu_add").ready(function () {
        // 定义验证参数
        var validateOptions = $.extend(CONST_VALIDATE.OPTION, {
            rules: {
                "m.encode": {
                    required: true,
                    maxlength: 10
                },
                "m.name": {
                    required: true,
                    maxlength: 45
                },
                "m.url": {
                    required: true,
                    maxlength: 255
                }
            },
            messages: {
                "m.encode": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入菜单缩写",
                    maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>菜单缩写不能大于{0}个字符")
                },
                "m.name": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入节点名称",
                    maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>节点名称不能大于{0}个字符")
                },
                "m.url": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入URL",
                    maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>URL不能大于{0}个字符")
                }
            },
            submitHandler:function(form) {
                var modal = $("#ajax_add");
                $(form).ajaxSubmit(function (data, status, xhr) {
                    if (data.status) {
                        toastr.success(data.msg, '操作提示');
                    } else {
                        toastr.error(data.msg, '操作提示');
                    }
                });
                $(modal).modal('hide');
            }
        });
        //表单验证
        var validator = $("#menu_add").validate(validateOptions);
    });
</script>